! function (n) {
    var e = n.document,
        t = e.documentElement,
        i = 640,
        d = i / 100,
        o = "orientationchange" in n ? "orientationchange" : "resize",
        a = function () {
            var n = t.clientWidth || 320;
            n > 640 && (n = 640);
            t.style.fontSize = n / d + "px"
        };
    e.addEventListener && (n.addEventListener(o, a, !1), e.addEventListener("DOMContentLoaded", a, !1))
}(window);

var app = {
    // 列表配置
	// {
	    // 图片路径
	    // imgUrl: '5b8e49ab49036.jpeg',
	    // 描述文字
	    // desc: "孕期瑜伽轻体验 - 上海 ",
	    // 链接地址
	    // href: "../Home/Nav/invitation/id/13.html",
	    // 图标类型
	    // type: 'food',
	    // 是否进行中
	    // act: true,
	// },
    listData: [
        /////////////////////////////////////////////// 食
        [{
            imgUrl: 'dinner-315.jpg',
            desc: "孕期营养膳食DIY",
            // href: "noodles.html",
            href: "../Home/Nav/invitation/id/30.html",
            type: 'food',
			act: true,
        },{
            imgUrl: '5b9a28856efe0.jpeg',
            desc: "孕期营养膳食DIY-北京",
            href: "../Home/Nav/invitation/id/21.html",
            type: 'food',
			act: true,
        },{
            imgUrl: '5c05053241721.jpg',
            desc: "浪荡夹肉馍",
            href: "../Home/Nav/invitation/id/24.html",
            type: 'food',
        },{
            imgUrl: 'jiwiejiu.jpg',
            desc: "夏日盛宴",
            href: "../Home/Nav/invitation/id/17.html",
            type: 'food',
         },{
            imgUrl: '5abc793f17bc0.jpg',
            desc: "让人想起彩虹下的幸福",
            // href: "noodles.html",
            href: "../Home/Nav/invitation/id/11.html",
            type: 'food',
        }, {
            imgUrl: '5c05051a3bef3.jpg',
            desc: "好心分手餐",
            href: "../Home/Nav/invitation/id/28.html",
            type: 'food',
         },{
            imgUrl: '5a9ea23226b58.jpg',
            desc: "孕期营养膳食DIY-上海",
            href: "../Home/Nav/invitation/id/2.html",
            type: 'food',
            
        },{
            imgUrl: '5c050545a4d18.jpg',
            desc: "花痴蒜蓉蝴蝶虾",
            href: "../Home/Nav/invitation/id/26.html",
            type: 'food',
        },{
            imgUrl: '5b251c365d648.png',
            desc: "三生三世 十里荷花",
            href: "../Home/Nav/invitation/id/14.html",
            type: 'food',
         },
// 		 {
//             imgUrl: '5be302f9e8cd5.jpeg',
//             desc: "狼人杀饭局攻略",
//             href: "../Home/Nav/invitation/id/27.html",
//             type: 'food',
//          },
		 {
            imgUrl: '5c050556b5979.jpg',
            desc: "闷骚全能肉燥",
            href: "../Home/Nav/invitation/id/25.html",
            type: 'food',
         },{
            imgUrl: 'wanshenjie.jpg',
            desc: "HALLOWEEN | 今夜拒绝正常人",
            href: "../Home/Nav/invitation/id/23.html",
            type: 'food',
         },{
            imgUrl: 'tea.jpeg',
            desc: "不可思议的的中国TEA",
            href: "../Home/Nav/invitation/id/7.html",
            type: 'food',
         }],
		 
		 
		 
        //////////////////////////////////////////////////// 秀
        [{
            imgUrl: 'photo-315.jpg',
            desc: "孕期美照全攻略",
            href: "../Home/Nav/invitation/id/32.html",
            type: 'photo',
			act: true,
        },{
            imgUrl: 'xiawucha.jpg',
            desc: "下午茶&时尚街拍体验",
            href: "../Home/Nav/invitation/id/16.html",
            type: 'photo',
        },{
			imgUrl: '5ab8bf32e51bd.jpeg',
			desc: "与昆曲艺术Deep Touch",
			href: "../Home/Nav/invitation/id/9.html",
			type: 'photo',
        },{
            imgUrl: 'shuimeiren.jpg',
            desc: "睡美人|晚间自我修复时间",
            href: "../Home/Nav/invitation/id/18.html",
            type: 'handwork',
        },{
           imgUrl: 'yunzhao.jpg',
           desc: "孕期美照全攻略",
           href: "../Home/Nav/invitation/id/3.html",
           type: 'photo', 
         },{
            imgUrl: 'jiweijiu2.jpg',
            desc: "夏日盛宴",
            href: "../Home/Nav/invitation/id/17.html",
            type: 'food',
         },{
            imgUrl: 'shougonghua.jpg',
            desc: "只为你最爱的人而花",
            href: "../Home/Nav/invitation/id/8.html",
            type: 'handwork',
        },{
            imgUrl: '5a9fbd5f0cb5c.png',
            desc: "开学第一课 花丝工艺",
            href: "../Home/Nav/invitation/id/5.html",
            type: 'handwork',
        },{
            imgUrl: 'guozi.jpg',
            desc: "low GI菓子 打造丰富生活",
            href: "../Home/Nav/invitation/id/10.html",
            type: 'food',
        },{
            imgUrl: 'wanshenjie2.jpg',
            desc: "HALLOWEEN | 今夜拒绝正常人",
            href: "../Home/Nav/invitation/id/23.html",
            type: 'food',
        },],
		
        
		
		//////////////////////////////////////////////// 瘦
        [ {
			imgUrl: 'yuga-315.jpg',
			desc: "孕期瑜伽轻体验（上海）",
			href: "../Home/Nav/invitation/id/33.html",
			type: 'yoga',
			act: true,
		},{
            imgUrl: '../../../Uploads/2019-03-29/5c9e066ba6086.png',
            desc: "孕期瑜伽轻体验（北京）",
            href: "../Home/Nav/invitation/id/34.html",
            type: 'yoga',
            act: true,
        },{
            imgUrl: '../../../Uploads/2019-03-29/5c9e14716b3b3.png',
            desc: "孕期瑜伽轻体验（苏州）",
            href: "../Home/Nav/invitation/id/22.html",
            type: 'yoga',
            act: true,
        },{
            imgUrl: 'naixi.jpg',
            desc: "孕期营养膳食DIY-北京",
            href: "../Home/Nav/invitation/id/21.html",
            type: 'food',
        },{
            imgUrl: 'noodles.jpg',
            desc: "让人想起彩虹下的幸福",
            // href: "noodles.html",
            href: "../Home/Nav/invitation/id/11.html",
            type: 'food',
        },{
			imgUrl: 'yoga1.jpg',
			desc: "孕期瑜伽轻体验",
			href: "../Home/Nav/invitation/id/13.html",
			type: 'yoga',
		},{
            imgUrl: 'naidong.jpg',
            desc: "孕期营养膳食DIY-上海",
            href: "../Home/Nav/invitation/id/2.html",
            type: 'food',
        },{
            imgUrl: 'yoga2.jpg',
		    desc: "孕期瑜伽轻体验",
		    href: "../Home/Nav/invitation/id/22.html",
		    type: 'yoga',
        },],

		
        ////////////////////////////////////////////////// 作
        [{
            imgUrl: '../../../Uploads/2019-03-29/5c9dfd8c3fc28.png',
            desc: "孕期高端护肤DIY",
            href: "../Home/Nav/invitation/id/31.html",
            type: 'handwork',
			act: true,
        },{
            imgUrl: '../../../Uploads/2019-03-29/5c9dfd505f201.png',
            desc: "自制宝宝出生礼（广州）",
            href: "../Home/Nav/invitation/id/36.html",
            type: 'handwork',
			act: true,
        },{
            imgUrl: '../../../Uploads/2019-03-29/5c9dfdfbba4fd.png',
            desc: "孕肚彩绘工坊（成都）",
            href: "../Home/Nav/invitation/id/35.html",
            type: 'handwork',
			act: true,
        },{
            imgUrl: '../../../Uploads/2019-03-29/5c9dfce44be9b.png',
            desc: "自家牧场DIY（杭州）",
            href: "../Home/Nav/invitation/id/37.html",
            type: 'handwork',
			act: true,
        },{
            imgUrl: 'T1.jpeg',
            desc: "只为你最爱的人而花",
            href: "../Home/Nav/invitation/id/8.html",
            type: 'handwork',
        },{
            imgUrl: 'hehua.jpg',
            desc: "三生三世 十里荷花",
            href: "../Home/Nav/invitation/id/14.html",
            type: 'food',
         },{
            imgUrl: '5bea62f1834de.png',
            desc: "孕期高端护肤DIY",
            href: "../Home/Nav/invitation/id/29.html",
            type: 'handwork',
        },{
            imgUrl: 'shouzuo.jpg',
            desc: "开学第一课 花丝工艺",
            href: "../Home/Nav/invitation/id/5.html",
            type: 'handwork',
        },{
            imgUrl: 'hufu.jpg',
            desc: "睡美人|晚间自我修复时间",
            href: "../Home/Nav/invitation/id/18.html",
            type: 'handwork',
        },{
            imgUrl: '5a9fb3f367c80.png',
            desc: "欢庭女人节 随身的香气",
            href: "../Home/Nav/invitation/id/4.html",
            type: 'handwork',
        },{
            imgUrl: 'jiweijiu3.jpg',
            desc: "夏日盛宴",
            href: "../Home/Nav/invitation/id/17.html",
            type: 'food',
         },{
            imgUrl: 'kafei.jpg',
            desc: "诗意咖啡实验室",
            href: "../Home/Nav/invitation/id/6.html",
            type: 'food',
         },{
            imgUrl: 'chaye.jpg',
            desc: "不可思议的的中国TEA",
            href: "../Home/Nav/invitation/id/7.html",
            type: 'food',
         }],
			
// 			{
//             imgUrl: 'runrun.jpg',
//             desc: "润润-沪上NO.1母婴摄影师",
// 			href: "http://wx.intable.net/Home/Nav/kolInfo/id/3.html",
//         }, {
//             imgUrl: 'guangmo.jpg',
//            desc: "广末-人称美食界的广末凉子",
//            href: "http://wx.intable.net/Home/Nav/kolInfo/id/10.html",
//         }, {
//              imgUrl: 'yisa.jpg',
//             desc: "YISA-国际瑜伽联盟认证导师",
//             href: "http://wx.intable.net/Home/Nav/kolInfo/id/8.html",
//         },{
//             imgUrl: 'yuuna.jpg',
//            desc: "Yuuna-人像及时尚服装摄影师",
//            href: "http://wx.intable.net/Home/Nav/kolInfo/id/15.html",
//         },{
//             imgUrl: 'amiee.jpg',
//            desc: "Amiee-资深瑜伽老师",
//            href: "http://wx.intable.net/Home/Nav/kolInfo/id/14.html",
//         },{
//             imgUrl: 'mumu.jpg',
//            desc: "木木-法餐界的魔法师",
//            href: "http://wx.intable.net/Home/Nav/kolInfo/id/13.html",
//         },{
//             imgUrl: 'koukou.jpg',
//            desc: "蔻蔻-国家高级公共营养师,高级西点师",
//            href: "http://wx.intable.net/Home/Nav/kolInfo/id/12.html",
//         },{
//             imgUrl: 'jianan.jpg',
//            desc: "简桉-调香达人.资深芳疗师",
//            href: "http://wx.intable.net/Home/Nav/kolInfo/id/11.html",
//         },{
//             imgUrl: 'chika.jpg',
//            desc: "CHIKA- 国内知名美食家",
//            href: "http://wx.intable.net/Home/Nav/kolInfo/id/5.html",
//         },{
//             imgUrl: 'cherry.jpg',
//            desc: "CHERRY-时髦美学生活方式达人",
//            href: "http://wx.intable.net/Home/Nav/kolInfo/id/6.html",
//         },{
//             imgUrl: 'june.jpg',
//            desc: "JUNE- 煮趣CES创始人/美食博主",
//            href: "http://wx.intable.net/Home/Nav/kolInfo/id/7.html",
//         },
		

    ],
    swiper: function () {
        var swiper = new Swiper('.swiper-container', {
            autoplay: 2000,
            loop: true,
            speed: 800,
            pagination: '.swiper-pagination',
        });
    },
    setList: function (index) {
        var _this = this

        // 清空列表
        $('.layout-list').html('')

        // 遍历数据 append进容器
        this.listData[index].forEach(function (o, i, a) {
            $('.layout-list').append(
                _this.getHtml(o)
            )
        })
    },
    getHtml: function (obj) {
        return ['<a class="li ' + (obj.act ? 'act' : '') + '" href="' + (obj.href || '#') + '">',
            '<div class="layout-box">',
            '<img src="./assets/images/' + obj.imgUrl + '">',
            '<div class="layout-desc ' + obj.type + '">',
            '<p>' + obj.desc + '</p>',
            '</div>',
            '</div>',
            '</a>'
        ].join('')
    },
    setColor(c) {
        $('body').css('background', c)
        $('.iconfont').css('color', c)
    },
    init: function () {
        var _this = this

        // 颜色配置在dom元素上v - bg - color

        // 分类点击事件
        $('.layout-filter-item').click(function (e, v) {
            $('.layout-filter-item').removeClass('act')
            $(this).addClass('act')
            _this.setColor($(this).attr('v-bg-color'))
            _this.setList($(this).attr('v-id'))
        })

        // 初始化背景颜色
        this.setColor($('.layout-filter-item').eq(0).attr('v-bg-color'))

        // 设置列表
        this.setList(0)

        this.swiper()
    }
}

$(function () {
    app.init()
})